package com.group.project.hrms.service.impl;

import com.group.project.hrms.entity.CheckPointInfo;
import com.group.project.hrms.mapper.CheckPointInfoMapper;
import com.group.project.hrms.service.ICheckPointInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

@Service
public class CheckPointInfoService implements ICheckPointInfoService {

    @Autowired
    private CheckPointInfoMapper checkPointInfoMapper;

    @Override
    public int insertCheckPointInfo(CheckPointInfo checkPointInfo) {
        return checkPointInfoMapper.insert(checkPointInfo);
    }

    @Override
    public int deleteCheckPointInfo(CheckPointInfo checkPointInfo) {
        return checkPointInfoMapper.deleteByPrimaryKey(checkPointInfo);
    }

    @Override
    public int updateCheckPointInfo(CheckPointInfo checkPointInfo) {
        return checkPointInfoMapper.updateByPrimaryKey(checkPointInfo);
    }

    @Override
    public CheckPointInfo selectOneCheckPointInfo(CheckPointInfo checkPointInfo) {
        return checkPointInfoMapper.selectByPrimaryKey(checkPointInfo);
    }

    @Override
    public CheckPointInfo selectOneCheckPointInfoByCheckPointID(String id) {
        Example example = new Example(CheckPointInfo.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("checkPointId" , id);
        return checkPointInfoMapper.selectOneByExample(example);
    }

    @Override
    public List<CheckPointInfo> selectAllCheckPointInfo() {
        return checkPointInfoMapper.selectAll();
    }
}
